package com.liuhouse1.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {

    //直接使用注解的方式为属性赋值
    @Value("${server.port}")
    private String port;

    @Value("${school.name}")
    private String name;

    @Value("${site}")
    private String site;

    @Value("${school.address}")
    private String address;

    @RequestMapping("/hello")
    @ResponseBody
    public String hello(){
        return "hello spring success";
    }


    @RequestMapping(value = "/data")
    @ResponseBody
    public String data(){
        System.out.println("端口:" + port + "学校名称 :" + name + "地址 :" + address + "site :" + site);
        return "端口:" + port + "学校名称 :" + name + "地址 :" + address + "site :" + site;
    }

}
